package com.abcdefg.rabbitmq.listener;

import com.abcdefg.rabbitmq.constant.Constants;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class WorkConsumerLister {
    @RabbitListener(queues = Constants.WORK_QUEUE)
    public void lister1(String message, Channel channel){
        System.out.println("lister 1 ["+Constants.WORK_QUEUE+"],接收到的消息："+message+
                ",channel"+channel);
    }
    @RabbitListener(queues = Constants.WORK_QUEUE)
    public void lister2(Message message){
        System.out.println("lister 2 ["+Constants.WORK_QUEUE+"],接收到的消息："+message);
    }
}
